package edu.lmu.cs.dhara.roflkode.entities;

import edu.lmu.cs.dhara.util.Log;

/**
 * The roflkode For statement.
 */
public class ForControl extends LoopControl {
	private Variable indexVariable;
	private String indexName;
	private Expression loopStart, loopEnd, array;
    private boolean incrementing;

    /**
     * Creates a while statement object.
     */
    public ForControl(String indexName, Expression loopStart, Expression loopEnd, boolean incrementing) {
    	this.indexName = indexName;
    	this.loopStart = loopStart;
    	this.loopEnd = loopEnd;
        this.incrementing = incrementing;
//        this.indexVariable = new Variable(indexName, Type.INT, loopStart)
    }
    
    public ForControl(String indexName, Expression array, boolean incrementing) {
    	this.indexName = indexName;
    	this.array = array;
        this.incrementing = incrementing;
//        this.indexVariable = new Variable(indexName, Type.INT, incrementing ? new IntegerLiteral("0") : )
    }
    
    /**
     * Returns the IndexVariable.
     */
    public Variable getIndexVariable() {
        return indexVariable;
    }
    
    /**
     * Returns the Index Name.
     */
    public String getIndexName() {
        return indexName;
    }
    
    /**
     * Returns the start of the loop.
     */
    public Expression getLoopStart() {
        return loopStart;
    }

    /**
     * Returns the end of the loop.
     */
    public Expression getLoopEnd() {
        return loopEnd;
    }
    
    /**
     * Returns the array to iterate through.
     */
    public Expression getArray() {
        return array;
    }
    
    /**
     * Returns the whether or not we're incrementing.
     */
    public boolean isIncrementing() {
        return incrementing;
    }

    /**
     * Analyzes this statement.
     */
    public void analyze(Log log, SymbolTable table, Function f, boolean inLoop) {
//        condition.analyze(log, table);
//        condition.assertBoolean("while_condition_not_boolean", log);
//        body.analyze(log, table, f, true);
    }
}
